package com.alex.core.contants.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 是|否
 * @author cb
 * @date 2019/10/17 11:02
 */
@AllArgsConstructor
@Getter
public enum IsOrNotEnum {
    // 1-是,0-否
    IS(1, "是"),
    NOT(0, "否"),
    ;
    private final Integer code;
    private final String value;

    public static IsOrNotEnum getByCode(Integer code) {
        for (IsOrNotEnum isOrNotEnum : values()) {
            if (isOrNotEnum.getCode().equals(code)) {
                return isOrNotEnum;
            }
        }
        return null;
    }
}
